import { defineStore } from 'pinia'

interface UserInfo {
  avatar: string
  id: string
  id_card: string
  is_pay: string
  is_pay_text: string
  is_real: string
  is_real_text: string
  is_vip: string
  is_vip_text: string
  mobile: string
  nickname: string
  real_name: string
  token: string
  chain_account: string
}
const useStore = defineStore({
  id: 'user',
  // arrow function recommended for full type inference
  state: () => ({
    // all these properties will have their type inferred automatically
    userInfo: {} as UserInfo
  }),
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'my_user',
        storage: localStorage
      }
    ]
  },
  getters: {
    userInfoGetter: (state) => state.userInfo
  }
})

export default useStore
